package com.example.templateapp.ui.adapter.base

import android.view.ViewGroup
import androidx.annotation.NonNull
import com.example.templateapp.ui.adapter.base.XDelegateAdapter
import com.xuexiang.xui.adapter.recyclerview.RecyclerViewHolder

/**
 *
 * @ProjectName:    TruckPriceChargeKotlin
 * @Package:        com.mtl.truckpricechargekotlin.adapter.base
 * @ClassName:      BaseDelegateAdapter
 * @Description:    java类作用描述
 * @Author:         yang yang
 * @CreateDate:     2020/5/7 0007 14:15
 * @UpdateUser:     更新者
 * @UpdateDate:     2020/5/7 0007 14:15
 * @UpdateRemark:   更新说明：
 * @Version:        1.0
 */
abstract class BaseDelegateAdapter<T> : XDelegateAdapter<T, RecyclerViewHolder> {

    constructor():super()

    constructor(list:Collection<T>):super(list)

    constructor(data : Array<T>):super(data)

    protected abstract fun getItemLayoutId(layoutId:Int) : Int

    @NonNull
    protected override fun getViewHolder(@NonNull parent:ViewGroup, layoutId: Int): RecyclerViewHolder{
        return RecyclerViewHolder(inflateView(parent,getItemLayoutId(layoutId)))

    }
}